let nums1 = [4,5,6,0,0,0]
let m =3
let nums2 = [1,2,3]
let  n = 3
var merge = function(nums1, m, nums2, n) {
    let j = m-1;
    let i = n-1;
    let big = m+n-1
    while(j>=0&&i>=0){
        if(nums1[j]>nums2[i]){
            nums1[big] = nums1[j];
            j--;
            big--;
            
        }else{
            nums1[big] = nums2[i];
            i--
            big--;
            
        }
    }
    if(i>=0){
        for(let a=0;a<=i;a++){
            nums1[a] = nums2[a] 
        }
    }
    return nums1 
};
console.log(merge(nums1, m, nums2, n));

